package com.ytjj.qmyx.admin.controller;


import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.request.ChannelUsersRequest;
import com.ytjj.qmyx.admin.service.ChannelUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/channelUsers")
public class ChannelUsersController {

    @Autowired
    private ChannelUsersService channelUsersService;
    /**
     * 增
     */
    @PostMapping("/add")
    public CommonResult add(@RequestBody ChannelUsersRequest request){
        return CommonResult.success(channelUsersService.add(request));
    }

    /**
     * 删
     */
    @PostMapping("/delete")
    public CommonResult delete(@RequestBody ChannelUsersRequest request){
        return CommonResult.success(channelUsersService.delete(request.getId()));
    }

    /**
     * 改
     */
    @PostMapping("/update")
    public CommonResult update(@RequestBody ChannelUsersRequest request){
        return CommonResult.success(channelUsersService.update(request));
    }

    /**
     * 查
     */
    @PostMapping("/select")
    public CommonResult select(@RequestBody ChannelUsersRequest request){
        return CommonResult.success(channelUsersService.select(request));
    }

    /**
     *  展示type=5的正常渠道用户
     * @return
     */
    @GetMapping("/channelUsersByType")
    public CommonResult channelUsersByType(){
        return CommonResult.success(channelUsersService.channelUsersByType());
    }
}
